Sentiment Analysis with Neural Networks

Importing Twits

Criteria Meet Specification

Length of Data

Print the number of twits in the dataset.

Preprocessing the Data

Criteria Meet Specification

Pre-Processing

The function preprocess correctly lowercases, removes URLs, removes ticker symbols, removes punctuation, tokenizes, and removes any single character tokens.

Preprocess All the Twits

Preprocess all the twits into the tokenized variable.

Bag of Words

Create a bag of words using the tokenized data.

Frequency of Words Appearing in Message

Remove most common and rare words by defining the following variables: freqs , low_cotoff , high_cutoff , K_most_common .

Updaing Vocabulary by Removing Filtered Words

Defining the variables : 'vacab', 'id2vocab' and 'filtered' correctly.

Neural Network

Criteria Meet Specification

TextClassifier. init

The init function correctly initializes the following parameters: self.vocab_size , self.embed_size , self.lstm_size , self.lstm_layers , self.dropout , self.embedding , self.lstm , and self.fc .

TextClassifier.init_hidden

The 'init_hidden' function generates a hidden state

TextClassifier.forward

The 'forward' function performs a forward pass of the model the parameter input using the hidden state.

Training

Criteria Meet Specification

Training and Validation

Correctly split the data into train_features , valid_features , train_labels , and valid_labels .

Training

Train your model with dropout and clip the gradient. Print out the training progress with the loss and accuracy.

Making Predictions

Criteria Meet Specification

Prediction

The predict function correctly prints out the prediction vector from the trained model.

What is the prediction of the model? What is the uncertainty of the prediction?

Answer what the prediction of the model is and the uncertainty of the prediction.